<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>后台管理</title>
    <meta name="author" content="DeathGhost"/>
    <link rel="stylesheet" type="text/css" href="Css/style.css">
    <!--[if lt IE 9]>
    <script src="Scripts/html5.js"></script>
    <![endif]-->
    <script src="Scripts/jquery.js"></script>
    <script src="Scripts/jquery.mcustomscrollbar.concat.min.js"></script>
    <script>


        (function ($) {
            $(window).load(function () {

                $("a[rel='load-content']").click(function (e) {
                    e.preventDefault();
                    var url = $(this).attr("href");
                    $.get(url, function (data) {
                        $(".content .mCSB_container").append(data); //load new content inside .mCSB_container
                        //scroll-to appended content
                        $(".content").mCustomScrollbar("scrollTo", "h2:last");
                    });
                });

                $(".content").delegate("a[href='top']", "click", function (e) {
                    e.preventDefault();
                    $(".content").mCustomScrollbar("scrollTo", $(this).attr("href"));
                });

            });
        })(jQuery);
    </script>
</head>

<body>
<!--header-->
<header>
    <h1><img src="Picture/admin_logo.png"/></h1>
    <ul class="rt_nav">
        <li><a href="#" class="website_icon">站点首页</a></li>
        <li><a href="#" class="admin_icon">DeathGhost</a></li>
        <li><a href="#" class="clear_icon">清除缓存</a></li>
        <li><a href="#" class="set_icon">账号设置</a></li>
        <li><a href="login.jsp" class="quit_icon">安全退出</a></li>
    </ul>
</header>
<!--aside nav-->
<!--aside nav-->
<aside class="lt_aside_nav content mCustomScrollbar">
    <h2><a href="index.jsp">起始页</a></h2>
    <ul>
        <li>
            <dl>
                <dt>商品信息</dt>
                <!--当前链接则添加class:active-->
                <dd><a href="product_list.jsp">商品列表</a></dd>
                <dd><a href="recycle_bin.jsp">商品回收站</a></dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>订单信息</dt>
                <dd><a href="order_list.jsp">订单列表</a></dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>配送</dt>
                <dd><a href="express_list.jsp">配送方式</a></dd>
                <dd><a href="product_detail.jsp" class="active">商品添加</a></dd>
            </dl>
        </li>
        <li>
            <dl>
                <dt>在线统计</dt>
                <dd><a href="discharge_statistic.jsp">流量统计</a></dd>
                <dd><a href="sales_volume.jsp">销售额统计</a></dd>
            </dl>
        </li>
        <li>
            <p class="btm_infor">© DeathGhost.cn 版权所有</p>
        </li>
    </ul>
</aside>
<c:if test="${distribution!=null}">
<form action="DistributionServlet?opr=update&id=${distribution.id}" method="post" enctype="multipart/form-data">
    </c:if>
    <c:if test="${distribution==null}">
    <form action="DistributionServlet?opr=insert" method="post" enctype="multipart/form-data">
        </c:if>
        <section class="rt_wrap content mCustomScrollbar">
            <div class="rt_content">
                <div class="page_title">
                    <h2 class="fl">添加配送方式</h2>
                    <a class="fr top_rt_btn gocp" href="express_list.jsp">返回产品列表</a>
                </div>
                <section>
                    <ul class="ulColumn2">
                        <li>
                            <span class="item_name" style="width:120px;">*商品名称：</span>
                            <input type="text" class="textbox textbox_295" placeholder="商品名称..." id="dName"
                                   name="dName" value="${distribution.dName}"/>
                            <span class="errorTips" id="goodsName_err">错误提示信息...</span>
                        </li>
                        <li>
                            <span class="item_name" style="width:120px;">*上传图片：</span>
                            <label class="uploadImg" style="height: 100px;width: 100px;" id="uploadImg">
                                <input type="file" id="filePath" name="filePath"/>
                                <span id="sp" style="padding-top: 15px">上传图片</span>
                                <img src="${distribution.dPath}" id="imgs" width="100px" height="100px"/>
                            </label>
                        </li>
                        <li>
                            <span class="item_name" style="width:120px;">商品描述：</span><br>
                            <span class="item_name" style="width:80px;"></span>
                            <textarea class="textarea" style="width:800px;height:150px;" placeholder="商品描述..."
                                      id="dDescribe"
                                      name="dDescribe">${distribution.dDescribe}</textarea>
                        </li>
                        <li>
                            <span class="item_name" style="width:120px; "></span>
                            <input type="button" class="link_btn" value="提交" id="but"/>
                        </li>
                    </ul>
                </section>
            </div>
        </section>
        <section class="pop_bg">
            <div class="pop_cont">
                <h3>操作响应</h3>
                <div class="pop_cont_text">
                </div>
                <div class="btm_btn">
                    <input type="button" value="确认" class="input_btn trueBtn" id="yz"/>
                    <input type="submit" value="确认" class="input_btn trueBtn" id="tj"/>
                    <input type="button" value="关闭" class="input_btn falseBtn"/>
                </div>
            </div>
        </section>
    </form>
    <script src="Scripts/ueditor.config.js"></script>
    <script src="Scripts/ueditor.all.min.js"></script>
    <script type="text/javascript">
    </script>
</body>

</html>
<script src="jquery.js"></script>
<script>
    if(${distribution==null}){
        $("#imgs").hide();
    }
    $("#goodsName_err").hide();
    $("#filePath").change(function () {
        $("#imgs").show();
        $("#sp").remove();
        $("#imgs").attr({"src": URL.createObjectURL(this.files[0]), "width": "100px","height":"100px"})
    });

    $("#but").click(function () {
        if(${distribution!=null}){
            $(".pop_cont_text").html("修改成功!");
        }else {
            $(".pop_cont_text").html("添加成功!");
        }
        $("#tj").show();
        $("#yz").hide();

        $(".pop_bg").fadeIn();
    })
    //弹出：取消或关闭按钮
    $(".falseBtn").click(function () {
        $(".pop_bg").fadeOut();
    });
</script>